import { baseRequest } from '@/utils/request'

const request = (url, ...arg) => baseRequest(`/job/` + url, ...arg)

export default {
	async updateJobConfigById(data) {
		return await request('update_by_id', data, 'post')
	},
	async jobConfigAdd(data) {
		return await request('add', data, 'post')
	},
	async queryJobConfigList(data) {
		return await request('list', data, 'post')
	},
	async getJobConfigById(data) {
		return await request('get_by_id', data, 'post')
	},
	async run(id) {
		return await request(`run/${id}`, {}, 'post')
	},
	async stop(id) {
		return await request(`pause/${id}`, {}, 'post')
	},
	async nextFireTime(id) {
		return await request(`next_fire_time/${id}`, {}, 'post')
	},
	async removeById(id) {
		return await request(`remove/${id}`, {}, 'post')
	}
}
